Skip to content

feat: RequestOptions for individual requests#476

Merged
64bit merged 22 commits into
mainfrom
request-options
Nov 18, 2025
Merged

feat: RequestOptions for individual requests#476
64bit merged 22 commits into
mainfrom
request-options

Conversation

@64bit
Copy link
Copy Markdown
Owner

@64bit 64bit commented Nov 18, 2025

Option to allow per request configurable headers and query parameters.

This enables chaining of methods to optionally provide custom query or headers, for example (only for demonstration):

client
  .chat()
  .query(&[("limit", 10)])?
  .list()
  .await?

or

client
  .chat()
  .header("key", "value")?
  .query(&[("limit", 10)])?
  .list()
  .await?

or

client
  .chat()
  .headers(HeaderMap::new())
  .list()
  .await?

@64bit 64bit merged commit 8b33483 into main Nov 18, 2025
1 check passed
@64bit 64bit deleted the request-options branch November 18, 2025 21:53
ifsheldon pushed a commit to ifsheldon/async-openai-wasm that referenced this pull request Nov 28, 2025
* feat: RequestOptions

* cargo fmt

* cargo clippy fix

* make RequestOptions methods as pub(crate)

* remove query parameters from individual methods

* update tests and examples to use RequestOptionsBuilder trait

* cargo fmt

* remove query params from all other methods

* update examples to use query chain method

* cargo clippy fix

* cargo fmt

* handle query properly

* fix bring-your-own-type tests

* query parameters for all APIs

* updated README

* fix example:

* cargo fmt

* namespaced query param types

* fix example

* update

* fix link

* only initialize request options vector when needed

(cherry picked from commit 8b33483)
kraemahz pushed a commit to subseq-io/async-openai that referenced this pull request Dec 12, 2025
* feat: RequestOptions

* cargo fmt

* cargo clippy fix

* make RequestOptions methods as pub(crate)

* remove query parameters from individual methods

* update tests and examples to use RequestOptionsBuilder trait

* cargo fmt

* remove query params from all other methods

* update examples to use query chain method

* cargo clippy fix

* cargo fmt

* handle query properly

* fix bring-your-own-type tests

* query parameters for all APIs

* updated README

* fix example:

* cargo fmt

* namespaced query param types

* fix example

* update

* fix link

* only initialize request options vector when needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant